<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css">
    <style>
        body{color: #333;background-color: #ccc;margin: 1em 10%;}
        ul{padding: 0;}
        li{float: left;padding: 1em;list-style: none;}
        a{color: #c60; background-color: transparent;font-weight: bold;text-decoration: none;}
        div{ width: 400px;height: 300px;}
        img{ width: 100%;height: 100%;}
    </style>
    <script>
        function showPic(whichPic){
            var source = whichPic.getAttribute('href');
            var placeholder = document.getElementById("placeholder");
            placeholder.setAttribute("src",source);

            //P 显示a标签的title
            var text = whichPic.getAttribute('title');
            var desp = document.getElementById('desp');
            desp.firstChild.nodeValue = text;
        }

        function countBodyChildren(){
            var b_element = document.getElementsByTagName('body')[0];
            alert(b_element.childNodes.length);
        }

    </script>
</head>
<body>
<h1>JavaScript 图片库</h1>
<ul>
    <li>
        <a href="../Slide/SuperSlide2.1-demo/images/new.png" title="linux" onclick="showPic(this);return false;">Linux</a>
    </li>
    <li>
        <a href="../Slide/SuperSlide2.1-demo/images/vis.png" title="apache" onclick="showPic(this);return false;">apache</a>
    </li>
    <li>
        <a href="../Slide/SuperSlide2.1-demo/images/howPay.png" title="mysql" onclick="showPic(this);return false;">mysql</a>
    </li>
    <li>
        <a href="../Slide/SuperSlide2.1-demo/images/blank.png" title="php" onclick="showPic(this);return false;">php</a>
    </li>
</ul>
<div>
    <img src="../Slide/SuperSlide2.1-demo/images/arrow.png" id="placeholder" alt="Hello"/>
</div>
<p id="desp">This is title!</p>

<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.bootcss.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<!--<script>-->
    <!--window.onload = countBodyChildren();-->
<!--</script>-->
</body>
</html>